package cn.yufu;

import java.util.Iterator;
import java.util.Set;

import redis.clients.jedis.Jedis;

public class RedisJava {
	public static void main(String[] args) {
		Jedis jedis = new Jedis("localhost");

		for (int i = 1; i < 50000; i++) {
			int bankSerialNum = 10000 + i;
			jedis.sadd("yufu", i + "|" + bankSerialNum + "|20171206|01");
		}

		for (int j = 1; j < 50003; j++) {
			if (j != 5000) {
				int bankSerialNum = 10000 + j;
				jedis.sadd("nucc", j + "|" + bankSerialNum + "|20171206|01");
			}
		}

		Set<String> result1 = jedis.sdiff("yufu", "nucc");
		Set<String> result2 = jedis.sdiff("nucc", "yufu");

		Iterator<String> it = result1.iterator();
		while (it.hasNext()) {
			String str = it.next();
			System.out.println("yufu:" + str);
		}

		Iterator<String> it2 = result2.iterator();
		while (it2.hasNext()) {
			String str = it2.next();
			System.out.println("nucc:" + str);
		}
		jedis.close();
	}
}